package com.hydra.framework.util;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

/**
 * Created by hasee on 2017/7/27.
 *
 */
public class CollectionUtil {

    public static <T> ArrayList<T> asList(@NonNull T...ts) {
        ArrayList<T> list = new ArrayList<>();

        list.addAll(Arrays.asList(ts));

        return list;
    }

    public static <T> boolean isEmpty(@Nullable Collection<T> collection) {
        return collection == null || collection.isEmpty();
    }

    public static <T> boolean isEmpty(@Nullable T[] objects) {
        return objects == null || objects.length == 0;
    }
}
